package awk.disruptor;

import com.lmax.disruptor.RingBuffer;

/**
 * @description:
 * @author: wanghaifeng
 * @date: 2020/12/23
 */
public class App {

    public static void main(String[] args) {
        //获取实例
        DisruptorUtil disruptorUtil = DisruptorUtil.getInstance();
        //启动
        RingBuffer<MessageEvent> ringBuffer = disruptorUtil.start();
        //发布消息
        disruptorUtil.produce("disruptor test !");
        //也可以这样
//        awk.disruptor2.MessageEventProducer producer = new MessageEventProducer(ringBuffer);
//        IntStream.range(0, 20).forEach(x -> {
//            producer.onData(x +  "Hello Disruptor!");
//        });
    }
}
